var initialState = {
  comments: "",
  lists: {},
  name: "",
  tologin: 0,
  newsId: [],
  title2: "",
  desc2: "",
  lists2: [],
  title3: "",
  desc3: "",
  lists3: [],
  clists:[]
};
const reducer = (state = initialState, action) => {
  switch (action.type) {
    case "LOGIN":
      return { name: action.payload };
      break;
    case "PCOMMENTS":
      return { comments: action.payload };
      break;
    case "TOLOGIN":
      return { tologin: action.payload };
      break;
    case "GETPRODUCTLISTS":
      return { ...state, lists: action.payload };
      break;
    case "GETLISTS":
      return {
        ...state,
        lists: action.payload
      };
      break;
    case "SETNEWSID":
      return {
        newsId: action.payload
      };
      break;
    case "GOTONEWDETAIL":
      return {
        newsId: action.payload
      };
      break;
    case "TITLE2":
      // return {count:state.count +1};
      return Object.assign({}, state, { title2: action.payload });
      // return {...state, count:state.count + 1};
      break;
    case "DESC2":
      // return {count1:state.count1 -1};
      return Object.assign({}, state, { desc2: action.payload });
      // return {...state , count1:state.count1 - 1};

      break;
    case "GETLISTS":
      return Object.assign({}, state, { lists3: action.payload });
      // return {...state , lists:[...state,lists,payload]};

      break;
    case "TITLE3":
      // return {count:state.count +1};
      return Object.assign({}, state, { title3: action.payload });
      // return {...state, count:state.count + 1};
      break;
    case "DESC3":
      // return {count1:state.count1 -1};
      return Object.assign({}, state, { desc3: action.payload });
      // return {...state , count1:state.count1 - 1};

      break;
    case "GETLISTS3":
      return Object.assign({}, state, { lists3: action.payload });
      // return {...state , lists:[...state,lists,payload]};

      break;
      case "SETCOMMENTS":
      return  {clists: action.payload};
      // return {...state , lists:[...state,lists,payload]};

      break;
    default:
      return state;
  }
};
module.exports = reducer;
